<template>
	<view class="banner-img" @click="goTest" :style="{padding: isResAd ? '0 52rpx' : '0'}">
		<image class="banner-img" :src="staticImgs.mailunBg" mode="widthFix" />
		<image class="mailun-btn" :src="staticImgs.mailunBtn" mode="widthFix" />
	</view>
</template>

<script>
	import {
		chakraSclInfo
	} from '@/common/api/scl_api'

	export default {
		props: {
			boxBg: {
				type: String,
				default: '',
				required: false
			},
			sourceType: {
				type: String,
				default: '',
				required: false
			},
			isResAd: {
				type: Boolean,
				default: false,
				required: false
			}
		},
		data() {
			return {
				detail: null,
				staticImgs: {
					mailunBg: this.$imgWxkjUrl + '/product/adv/ml_adv_top_banner_new_new.png',
					// mailunBtn: this.$imgWxkjUrl + '/product/question/mailun-btn.png',
					mailunBtn: this.$imgWxkjUrl + '/product/priceImg/ml_1ydz.png?'+Math.random()
				}
			}
		},
		methods: {
			goTest() {
				if (!this.detail) {
					return
				}
				// if (this.detail.reportId) {
				// 	uni.navigateTo({
				// 		url: '/subcontractorB/pages/sclResult/sclResult?id=' + this.detail.reportId
				// 	})
				// } else {
					
				// }
				
				if (this.sourceType) {
					this.$u.api.addLog({
						sclId: this.detail.sclId,
						sourseType: this.sourceType
					})
				}
				uni.navigateTo({
					url: '/subcontractorMaiLun/pages/introduce/introduce?sclId=' + this.detail.sclId +
						'&merchandiseId=' + this.detail.merchandiseId
				})
			}
		},
		created() {
			chakraSclInfo().then(res => {
				this.detail = res.data.data
			})
		}
	}
</script>

<style scoped lang="scss">
	@keyframes zoom {

		0%,
		100% {
			transform: scale(1);
		}

		50% {
			transform: scale(1.5);
		}
	}

	.banner-img {
		width: 100%;
		position: relative;
		box-sizing: border-box;
	}

	.mailun-btn {
		position: absolute;
		top: 132rpx;
		left: 455rpx;
		width: 212rpx;
		height: 78rpx;
		animation: zoom 2s linear infinite;
	}
</style>